package com.flute.haflute.net;

import gnu.cajo.invoke.Remote;
import gnu.cajo.utils.ItemServer;

import java.io.IOException;

import com.flute.haflute.common.ClusterContext;

public class RMILocalService {
private static RMILocalService instance= new RMILocalService();
	
	public static RMILocalService getInstance() {
		return instance;
	}
	
	public RMILocalService() {
		//config CAJO
		Remote.config("0.0.0.0", ClusterContext.getRMIPort() - 1 , "localhost", 0);
	}
	
	public void bindService(Object serviceObj, String serviceName) throws IOException {
		ItemServer.bind(serviceObj, serviceName);
	}
	
	public void shutdown() {
		Remote.shutdown();
	}

}
